//
//  QZShopListCell.m
//  WWShop
//
//  Created by 超群 on 15/10/14.
//  Copyright © 2015年 qunzhu.Team. All rights reserved.
//

#import "QZShopListCell.h"
#import "QZShopModel.h"

#import "UIImageView+WebCache.h"

@interface QZShopListCell()
@property (strong, nonatomic)  UILabel *priceLabel;
@property (strong, nonatomic)  UILabel *titleLabel;
@property (strong, nonatomic)  UILabel *payPepoleLabel;
@property (weak, nonatomic)  UIImageView *leftImage;

@end
@implementation QZShopListCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
       [self setSelectionStyle:UITableViewCellSelectionStyleNone];
        [self createView];
        self.contentView.backgroundColor = [UIColor colorWithRed:240/255.0 green:239/255.0 blue:244/255.0 alpha:1];
    
    }
    return self;
}

-(void)createView{
    
    
    UIView *bgview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 90)];
    bgview.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:bgview];
    
    UIImageView *view = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 70, 70)];
    _leftImage= view;
    view.image = [UIImage imageNamed:@"shop2"];
    [bgview addSubview:view];
    
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxY(view.frame)+10, 10, SCREEN_W-CGRectGetMaxY(view.frame)-30,50)];
    _titleLabel = label;
    label.text = @"完美造型完美造型完美造型完美造型完美造型完美造型";
    label.textColor = [UIColor darkGrayColor];
    label.numberOfLines = 0;
    label.textColor = [UIColor darkGrayColor];
    [bgview addSubview:label];
    
    
    UILabel *price = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxY(view.frame)+10, 60, SCREEN_W-CGRectGetMaxY(view.frame)-30,30)];
    _priceLabel = price;
    price.text = @"$256";
    price.numberOfLines = 0;
    price.textColor = [UIColor colorWithRed:(180)/255.0f green:(90)/255.0f blue:(234)/255.0f alpha:1];
    [bgview addSubview:price];
    
    
    UILabel *pepoleNo = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_W-100, 60, 100,30)];
    _payPepoleLabel = pepoleNo;
    pepoleNo.text = @"1889人付款";
    pepoleNo.font = [UIFont systemFontOfSize:14];
    pepoleNo.textColor = [UIColor darkGrayColor];
    pepoleNo.numberOfLines = 0;
    pepoleNo.textColor = [UIColor darkGrayColor];
    [bgview addSubview:pepoleNo];
 
    
    
    
}
-(void)setShopModel:(QZShopModel *)shopModel{
    _shopModel = shopModel;
    
   
    
    [_leftImage sd_setImageWithURL:[NSURL URLWithString:shopModel.img] placeholderImage:[UIImage imageNamed:@"shop2"]];
    
    _titleLabel.text = shopModel.prodName;
    
    _priceLabel.text = [NSString stringWithFormat:@"￥%@",shopModel.price2];
    
    _payPepoleLabel.text = [NSString stringWithFormat:@"%ld人付款",shopModel.saleNum];
    
    
}

@end
